import Vue  from 'vue';
import Vuex from 'vuex';
import { Module } from 'vuex';
import test from './test'

Vue.use(Vuex as any);

function addNameSpace(mod,name:string) {
    mod.namespaced = name;
    return mod;
}

function getModules(modules){
    Object.keys(modules).forEach(key =>{
        addNameSpace(modules[key], key);
    })
    return modules;
}


const store = new Vuex.Store({

    modules: getModules({
        test,
    }),

    state: {

    },

    mutations: {

    }
    
})

export default store
